package com.jwt.vpower.view.ui {
	import com.greensock.TweenLite;
	import com.ui.Assets;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import shell.components.shellvideo;
	
	public class TourGuideOverlay extends DisplayClip {
		
		private var _overlay:Sprite;
		private var _video:shellvideo;
		private var _closeBtn:Sprite;
		
		
		public function TourGuideOverlay(xml:XML) {
			_overlay = new Sprite();
			_overlay.graphics.beginFill(0x333333,.8);
			_overlay.graphics.drawRect(0,0,752,350);
			_overlay.addEventListener(MouseEvent.MOUSE_DOWN, close, false, 0 , true);
			_overlay.graphics.endFill();
			_overlay.alpha=0;
			addChild(_overlay)
			
			
			_video = new shellvideo(480,270);
			_video.x = 136;
			_video.y = 40;
			_video.name = "video";
			_video.node = "video";
			_video.contentxml = xml..tourGuide[0];
			_video.alpha = 0;
			addChild(_video);
			
			_closeBtn = new Assets.BUTTON_CLOSE()
			_closeBtn.alpha=.6
			_closeBtn.x=(732)
			_closeBtn.y=6;
			_closeBtn.addEventListener(MouseEvent.CLICK, close, false, 0 , true)
			_closeBtn.buttonMode=true;
			addChild(_closeBtn);
		
		
			
			addEventListener(Event.ADDED_TO_STAGE,init);
		}
		
		private function init(e:Event):void {
			removeEventListener(Event.ADDED_TO_STAGE,init);
			TweenLite.to(_overlay,.3,{alpha:1,onComplete:showVideo});
		}
		
		private function showVideo():void {
			TweenLite.to(_video,.3,{alpha:1});	
		}
		
		private function close(e:Event):void {
			dispatchEvent(new Event(DialogWindow.CLOSE_POP_UP))
		}
	}
}